Tryit Editor v2.3

Edit This Code:
<!DOCTYPE html> <html> <head> <style> .example { color: red; padding: 5px; width: 150px; font-size: 15px; } .newClass { color: blue; padding: 15px; width: 250px; font-size: 18px; background-color: white; } </style> </head> <body> <p>Click the button to change the value of the button element's second attribute.</p> <button onclick="myFunction()" class="example">Try it</button> <script> function myFunction() { var a = document.getElementsByTagName("BUTTON")[0]; a.attributes[1].value = "newClass"; } </script> </body> <!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_namednodemap_item4 by HTTrack Website Copier/3.x [XR&CO'2014], Fri, 23 Jan 2015 08:29:12 GMT --> </html>
Result:
Try it Yourself - © w3schools.com